package com.ror.java.se.scanner;

import java.util.Scanner;

public class Demo01NextLine {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        scanNext();
        scanNextLine();
    }

    private static void scanNext() {
        System.out.print("（next方式截取）等待输入：");
        if (!sc.hasNext()) {
            System.out.println("你没有输入任何字符。");
            return;
        }
        System.out.println("你的输入：" + sc.next());
    }

    private static void scanNextLine() {
        System.out.print("（nextLine方式截取）等待输入：");
        if (!sc.hasNextLine()) {
            System.out.println("你没有输入任何字符。");
            return;
        }
        System.out.println("你的输入：" + sc.nextLine());
    }

}
